//
//  PCWithdrawManager.m
//  PromotionCode
//
//  Created by uuu9 on 2017/12/8.
//  Copyright © 2017年 My. All rights reserved.
//

#import "PCWithdrawManager.h"
#import "PCPointsHistoryModel.h"
#import "PCWithdrawHistoryModel.h"
#import "PCWithdrawModel.h"

@implementation PCWithdrawManager

+(void)withdrawWithMoney:(NSString *)money andUserID:(NSString *)uid andSessionID:(NSString *)sessionid andCompletionHandle:(void (^)(PCWithdrawModel *model, NSError *error))complete{
    [self EncryptPOST:[NSString stringWithFormat:@"%@%@",Api_URL,kWithdraw]
           parameters:[NSString stringWithFormat:@"userid=%@&sessionid=%@&moneny=%@",uid,sessionid,money]
    completionHandler:^(id responseObj, NSError *error) {
        PCWithdrawModel *model = [PCWithdrawModel mj_objectWithKeyValues:responseObj];
        if (model.error_code != 0) {
            error = [self createError:model.error_msg];
        }
        complete(model,error);
    }];
    
}




+(void)getWithdrawHistoryWithUserID:(NSString *)uid andSessionID:(NSString *)sessionid andCompletionHandle:(void (^)(PCWithdrawHistoryModel *, NSError *))complete{
    [self EncryptPOST:[NSString stringWithFormat:@"%@%@",Api_URL,kWithdrawHistory]
           parameters:[NSString stringWithFormat:@"userid=%@&sessionid=%@",uid,sessionid]
    completionHandler:^(id responseObj, NSError *error) {
        PCWithdrawHistoryModel *model = [PCWithdrawHistoryModel mj_objectWithKeyValues:responseObj];
        if (model.error_code != 0) {
            error = [self createError:model.error_msg];
        }
        complete(model,error);
    }];
    
}
@end
